
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>语料库管理系统</title>
    <meta name="description" content="关爱残疾人，沟通无障碍。">
    <meta name="keyword" content="手语，语料库，残疾人，沟通，无障碍。">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="assets/favicon.ico" rel="icon">
    <link rel="stylesheet" href="component/pear/css/pear.css" />
    <link rel="stylesheet" href="assets/css/main.css" />
    <style>
        html, body { background-color: whitesmoke }
        .layui-container { margin: 15px auto 15px auto; }
    </style>
</head>
<body>
    <!-- header -->
    <div class="ew-header">
        <img class="layui-logo" src="assets/images/un28.svg" style="height:50px;padding: 10px;" />
        <div class="ew-nav-group">
            <div class="nav-toggle"> <i class="layui-icon layui-icon-more-vertical"> </i> </div>
            <ul class="layui-nav" lay-filter="ew-header-nav">
                <li class="layui-nav-item">
                    <a href="index.html">首页</a>
                </li>
                <li class="layui-nav-item layui-this">
                    <a href="add.html">提交语料库</a>
                </li>
                <li class="layui-nav-item">
                    <a href="search.html">语料库检索</a>
                </li>
                <li class="layui-nav-item">
                    <a href="show.html">全文手语翻译</a>
                </li>
                <li class="layui-nav-item">
                    <a href="main.html">进入管理</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-container" id="app">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-header"> 说明</div>
                    <div class="layui-card-body">
                    </div>
                </div>
            </div>
            <div class="layui-col-md8">
                <div class="layui-card">
                    <div class="layui-card-header"> 语料库提交</div>
                    <div class="layui-card-body add">
                        <form class="layui-form" action="javascript:void(0);">
                            <div class="layui-form-item">
                                <label class="layui-form-label"> 词义</label>
                                <div class="layui-input-inline">
                                    <input type="hidden" name="gif" id="gif">
                                    <input type="text" name="word" lay-verify="required" placeholder="请输入词义" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label"> 作者</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="author" lay-verify="required" placeholder="请输入作者" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label"> 手语图片</label>
                                <div class="layui-input-block">
                                    <div class="layui-upload-drag" id="test10">
                                        <i class="layui-icon"> </i>
                                        <p> 说明：仅支出GIF图片，图片大小360*202像素</p>
                                        <div class="layui-hide" id="uploadDemoView">
                                            <hr>
                                            <img src="" alt="上传成功后渲染" style="width: 360px;height:202px">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="add"> 立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary"> 重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- footer -->
    <div class="ew-footer">
        <div class="layui-container">
            <div class="layui-row layui-col-space30">
                <div class="layui-col-md6">
                    <h2 style="font-size: 17px;" class="footer-item-title"> 技术交流</h2>
                    <p class="img-group" style="height: 105px;font-size: 15.5px;">
                        <img src="assets/images/code2.png" style="border-radius: 2px;height: 100px;width: 100px;" />
                        扫码加入技术交流QQ群<br> 备案号：云ICP备20230323XX号
                    </p>
                </div>
                <div class="layui-col-md4">
                    <h2 style="font-size: 17px;" class="footer-item-title"> 联系我们</h2>
                    <p>
                        <i class="layui-icon layui-icon-dialogue"> </i>
                        <a href="http://www.duanztai.top"> 官网 : www.duanztai.top</a>
                    </p>
                    <p style="margin-top: 2px;">
                        <i class="layui-icon layui-icon-website"> </i>
                        <a href="https://gitee.com/duanzt/shou-yu-corpus"> 仓库 : gitee.com/duanzt/shou-yu-corpus</a>
                    </p>
                </div>
                <div class="layui-col-md2">
                    <h2 style="font-size: 17px;" class="footer-item-title"> 相关链接</h2>
                    <p> <i class="layui-icon layui-icon-component"> </i> <a href="https://gitee.com/duanzt/shou-yu-corpus" target="_blank"> 组织</a> </p>
                    <p style="margin-top: 10px;">
                        <i class="layui-icon layui-icon-home"> </i>
                        <a href="https://gitee.com/duanzt/shou-yu-corpus" target="_blank"> 仓库</a>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <!-- Js 部分 -->
    <script type="text/javascript" src="component/layui/layui.js"></script>
    <script type="text/javascript" src="component/pear/pear.js"></script>
    <script>
        layui.use(['upload', 'form', 'loading', 'http', 'toast','layer'], function () {
            var $ = layui.jquery;
            var upload = layui.upload;
            var form = layui.form;
            var loading = layui.loading;
            var http = layui.http;
            var toast = layui.toast;
            var layer = layui.layer;
            loading.Load(5, '加载中...');           

            upload.render({
                elem: '#test10'
                , url: '/YuLiaoK/Upload'
                , done: function (res) {
                    layer.msg('上传成功');
                    layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.result.src);
                    $('#gif').val(res.result.src);
                }
            });
            //
            form.on('submit(add)', function (data) {
                //
                if ($('#gif').val() == '') {
                    toast.warning({ title: "警告", message: "请先上传手语图片", position: 'topRight' })
                    return;
                }
                //
                loading.block({ type: 5, elem: '.add', msg: '请稍等...' });
                http.ajax({
                    url: '/YuLiaoK/Add',
                    data: JSON.stringify(data.field)
                }).done(function (data) {
                    layer.open({
                        icon: 1,
                        title: '系统提示'
                        , content: '上传成功，请等待审核！'
                        , yes: function (layero, index) {                       
                            window.location.reload();
                        }
                    });
                }).always(function () {
                    loading.blockRemove(".add", 500);
                });

                return false;
            });
            loading.loadRemove(500);
        });
    </script>
</body>
</html>
